﻿document.getElementById("tbPwd").onblur = pwdBlur;
document.getElementById("tbPwd").onkeyup = pwdBlur;
function pwdBlur() {
    document.getElementById("hidPwd").value =
 hex_md5(hex_md52(document.getElementById("tbPwd").value).toUpperCase()
 + document.getElementById("randCode").value);
}
//提交
    function onSubmit() {
        //var s = hex_md52(document.getElementById("tbPwd").value).toUpperCase();
        //alert(s);
        document.getElementById("errorMessage").innerHTML="";
        document.getElementById('randCode').value = '';
        document.getElementById('tbPwd').value = '';
        document.getElementById('btnLogin').setAttribute('disabled', 'disabled');
        return true;
    }
 document.onkeyup = function (e) {
     try {
         if (!e) { e = window.event; }
     } catch (c) {
     }
     if (e.keyCode == 13) {
         var login = document.getElementById("btnLogin");
         login.click();
     }
     if (event.keyCode == 27) {
         document.getElementById("tbName").value = "";
         document.getElementById("tbPwd").value = "";
     }
 };


 $(function () {
     //获取随机code
     $.ajax({
         type: "get", url: window.GetRandCodeUrl, cache: false, success: function (result) {
             if (result!= undefined) {
                 $("#randCode").val(result.randCode);
             }
             pwdBlur();
         }
     }
     );
     document.getElementById('tbPwd').value = 'abc';
 });
